import 'dart:io' show Platform;

/// 平台相关配置
class AppPlatform {
  // 平台判断
  static bool get isIOS => Platform.isIOS;
  static bool get isAndroid => Platform.isAndroid;
  static bool get isWeb => const bool.fromEnvironment('dart.library.js_util');
  static bool get isMobile => isIOS || isAndroid;
  static bool get isDesktop => Platform.isWindows || Platform.isMacOS || Platform.isLinux;
  
  // 平台名称
  static String get platformName => Platform.operatingSystem;
  static String get displayName {
    if (isIOS) return 'iOS';
    if (isAndroid) return 'Android';
    if (Platform.isWindows) return 'Windows';
    if (Platform.isMacOS) return 'macOS';
    if (Platform.isLinux) return 'Linux';
    return 'Unknown';
  }
  
  // 系统信息
  static String get systemVersion => Platform.operatingSystemVersion;
  static String get localeName => Platform.localeName;
  
  // // User-Agent 构建
  // static String buildUserAgent({String appName = 'YH-SmartHome', String version = '1.0.0'}) {
  //   return '$appName/$version ($displayName)';
  // }
  
  // 平台特定配置
  static const Map<String, dynamic> _iosConfig = {
    'statusBarStyle': 'light',
    'navigationBarStyle': 'cupertino',
    'defaultTimeout': 20,
  };
  
  static const Map<String, dynamic> _androidConfig = {
    'statusBarStyle': 'dark',
    'navigationBarStyle': 'material',
    'defaultTimeout': 30,
  };
  
  static Map<String, dynamic> get platformConfig {
    return isIOS ? _iosConfig : _androidConfig;
  }
  
  // 获取平台特定的超时时间
  static int get defaultTimeout => platformConfig['defaultTimeout'] as int;
}
